home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / WorldScript.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  9.2 KB  |  275 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Contains:    WorldScript I Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  19. __WORLDSCRIPT__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  25.     include 'Traps.a'
  26.     ENDIF
  27.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  28.     include 'QuickdrawText.a'
  29.     ENDIF
  30.  
  31. ; typedef UInt16                         WSIOffset
  32.  
  33. ; typedef UInt8                         WSIByteCount
  34.  
  35. ; typedef UInt8                         WSIByteIndex
  36.  
  37. ;  offset from start of sub-table to row in state table 
  38. ; typedef UInt16                         WSIStateOffset
  39.  
  40. ; typedef UInt32                         WSITableOffset
  41.  
  42. ; typedef UInt16                         WSISubtableOffset
  43.  
  44. ; typedef UInt16                         WSIGlyphcode
  45.  
  46. ; typedef UInt32                         WSITableIdentifiers
  47.  
  48.  
  49. kScriptSettingsTag                EQU        'info'
  50. kMetamorphosisTag                EQU        'mort'
  51. kGlyphExpansionTag                EQU        'g2g#'
  52. kPropertiesTag                    EQU        'prop'
  53. kJustificationTag                EQU        'kash'
  54. kCharToGlyphTag                    EQU        'cmap'
  55. kGlyphToCharTag                    EQU        'pamc'
  56. kFindScriptRunTag                EQU        'fstb'
  57.  
  58.  
  59. ; ***             L O O K U P    T A B L E    T Y P E S        ***
  60.  
  61. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  62. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  63. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  64. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  65. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  66. ; typedef unsigned short                 WSILookupTableFormat
  67.  
  68. ; typedef unsigned short                 WSILookupValue
  69.  
  70. ;  An offset from the beginning of the lookup table 
  71. ; typedef unsigned short                 WSILookupOffset
  72.  
  73. ;     FORMAT SPECIFIC DEFINITIONS 
  74. ;        lookupSimpleArray:
  75. ;        
  76. ;        This is a simple array which maps all glyphs in the font
  77. ;        to lookup values.
  78. ;    
  79.  
  80. WSILookupArrayHeader    RECORD 0
  81. lookupValues             ds.w    1                ; offset: $0 (0) <-- really an array of length one ;  The array of values indexed by glyph code 
  82. sizeof                     EQU *                    ; size:   $2 (2)
  83.                         ENDR
  84. ;        lookupTrimmedArray:
  85. ;        
  86. ;        This is a single trimmed array which maps a single range
  87. ;        of glyhs in the font to lookup values.
  88. ;    
  89.  
  90. WSILookupTrimmedArrayHeader RECORD 0
  91. firstGlyph                 ds.w    1                ; offset: $0 (0)
  92. limitGlyph                 ds.w    1                ; offset: $2 (2)
  93. valueArray                 ds.w    1                ; offset: $4 (4) <-- really an array of length one
  94. sizeof                     EQU *                    ; size:   $6 (6)
  95.                         ENDR
  96. ;  The format specific part of the subtable header 
  97. WSILookupFormatSpecificHeader RECORD 0
  98. simpleArray                 ds        WSILookupArrayHeader ; offset: $0 (0)    ;  rename lookupArray as simpleArray <9> 
  99.                          ORG 0
  100. trimmedArray             ds        WSILookupTrimmedArrayHeader ; offset: $0 (0)
  101. sizeof                     EQU *                    ; size:   $6 (6)
  102.                         ENDR
  103. ;  The overall subtable header 
  104. WSILookupTableHeader    RECORD 0
  105. format                     ds.w    1                ; offset: $0 (0)        ;  table format 
  106. fsHeader                 ds        WSILookupFormatSpecificHeader ; offset: $2 (2) ;  format specific header 
  107. sizeof                     EQU *                    ; size:   $8 (8)
  108.                         ENDR
  109.  
  110. ; ***        G L Y P H    E X P A N S I O N    ***
  111.  
  112.                                                             ; fixed 1.0 
  113. kCurrentGlyphExpansionVersion    EQU        $00010000
  114. ; typedef unsigned short                 GlyphExpansionFormats
  115.  
  116.  
  117. GlyphExpansionLookupFormat        EQU        1
  118. GlyphExpansionContextualFormat    EQU        2
  119. ExpandedGlyphCluster    RECORD 0
  120. numGlyphs                 ds.b    1                ; offset: $0 (0)
  121. bestGlyph                 ds.b    1                ; offset: $1 (1)
  122. glyphs                     ds.w    1                ; offset: $2 (2) <-- really an array of length one
  123. sizeof                     EQU *                    ; size:   $4 (4)
  124.                         ENDR
  125. ExpandedGlyphOffset        RECORD 0
  126. glyph                     ds.w    1                ; offset: $0 (0)
  127. offset                     ds.w    1                ; offset: $2 (2)        ;  offset to ExpandedGlyphCluster 
  128. sizeof                     EQU *                    ; size:   $4 (4)
  129.                         ENDR
  130. GlyphExpansionStateTable RECORD 0
  131. stateTableOffset         ds.w    1                ; offset: $0 (0)
  132. classTableOffset         ds.w    1                ; offset: $2 (2)
  133. actionTableOffset         ds.w    1                ; offset: $4 (4)        ;  state, class and actions tables follow here... 
  134. sizeof                     EQU *                    ; size:   $6 (6)
  135.                         ENDR
  136. GlyphExpansionTable        RECORD 0
  137. version                     ds.l    1                ; offset: $0 (0)
  138. format                     ds.w    1                ; offset: $4 (4)
  139. expansionNumer             ds.w    1                ; offset: $6 (6)
  140. expansionDenom             ds.w    1                ; offset: $8 (8)        ;  num/denom ratio for expansion <2> 
  141. stateTable                 ds        GlyphExpansionStateTable ; offset: $A (10)
  142.                          ORG 10
  143. lookup                     ds        WSILookupTableHeader ; offset: $A (10) ;  expanded glyph clusters follow here... 
  144. sizeof                     EQU *                    ; size:   $12 (18)
  145.                         ENDR
  146.  
  147. ;  Glyph-to-Character constants and types  
  148.  
  149. kCurrentGlyphToCharVersion        EQU        $00010100
  150. ; typedef unsigned short                 GlyphToCharLookupFormats
  151.  
  152.  
  153. kGlyphToCharLookup8Format        EQU        1
  154. kGlyphToCharLookup16Format        EQU        2
  155. kGlyphToCharLookup32Format        EQU        3
  156. ; typedef UInt8                         GlyphToCharFontIndex
  157.  
  158. ; typedef UInt8                         QDGlyphcode
  159.  
  160. GlyphToCharActionTable    RECORD 0
  161. fontNameOffset             ds.w    1                ; offset: $0 (0)        ;  offset relative to this table 
  162. actions                     ds        WSILookupTableHeader ; offset: $2 (2)    ;  only support lookupSimpleArray format for now 
  163. sizeof                     EQU *                    ; size:   $A (10)
  164.                         ENDR
  165. GlyphToCharActionHeader    RECORD 0
  166. numTables                 ds.w    1                ; offset: $0 (0)        ;  0..n 
  167. offsets                     ds.w    1                ; offset: $2 (2) <-- really an array of length one ;  offsets from start of action table header 
  168. sizeof                     EQU *                    ; size:   $4 (4)
  169.                         ENDR
  170. GlyphToCharHeader        RECORD 0
  171. version                     ds.l    1                ; offset: $0 (0)
  172. actionOffset             ds.w    1                ; offset: $4 (4)        ;  offset to GlyphToCharActionHeader 
  173. format                     ds.w    1                ; offset: $6 (6)        ;  size of font mask 
  174. mappingTable             ds        WSILookupTableHeader ; offset: $8 (8)
  175. sizeof                     EQU *                    ; size:   $10 (16)
  176.                         ENDR
  177.  
  178. ;  JUSTIFICATION TYPES
  179. ;    WorldScript supports justification of text using insertion. The justification
  180. ;    table specifies a insertion string to insert between 2 specified glyphs.
  181. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  182. ;    the higher the priority the more justification strings inserted at that position.
  183. ;    
  184. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  185. ;    state table.
  186. ;    
  187. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  188. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  189. ;    per inserting string is specified in the justification table.
  190. ;
  191. ;
  192.  
  193.  
  194.                                                             ; 1.0 not supported 
  195. kCurrentJustificationVersion    EQU        $0200
  196.  
  197. kJustificationStateTableFormat    EQU        1
  198.  
  199.                                                             ; WSI's internal limitation <12> 
  200. kMaxJustificationStringLength    EQU        13
  201. ; typedef UInt8                         WSIJustificationPriority
  202.  
  203.  
  204. WSIJustificationSetMarkMask        EQU        $80
  205. WSIJustificationStateEntry RECORD 0
  206. markPriority             ds.b    1                ; offset: $0 (0)        ;  non-zero priorities means insertion 
  207. priority                 ds.b    1                ; offset: $1 (1)
  208. newState                 ds.w    1                ; offset: $2 (2)
  209. sizeof                     EQU *                    ; size:   $4 (4)
  210.                         ENDR
  211. ; typedef unsigned short                 WSIJustificationClasses
  212.  
  213.  
  214. wsiJustEndOfLineClass            EQU        0
  215. wsiJustEndOfRunClass            EQU        1
  216. wsiJustDeletedGlyphClass        EQU        2
  217. wsiJustUserDefinedClass            EQU        3
  218. ; typedef unsigned short                 WSIJustificationStates
  219.  
  220.  
  221. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  222. wsiStartOfRunState                EQU        1
  223. wsiUserDefinedState                EQU        2
  224. ;  pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  225. ; typedef UInt8                         WSIJustificationClassOffset
  226.  
  227. WSIJustificationStateTable RECORD 0
  228. maxPriorities             ds.w    1                ; offset: $0 (0)
  229. rowWidth                 ds.w    1                ; offset: $2 (2)        ;  width of a state table row in bytes 
  230. classTableOffset         ds.w    1                ; offset: $4 (4)
  231. stateTableOffset         ds.w    1                ; offset: $6 (6)
  232. sizeof                     EQU *                    ; size:   $8 (8)
  233.                         ENDR
  234. ;            Last two fields of above structure - someday?
  235. ;            WSIJustificationClassOffset    classes[up to 64 classes supported];
  236. ;            WSIJustificationStateEntry    states[up to your heart's desire];
  237. ;        
  238.  
  239. WSIJustificationHeader    RECORD 0
  240. version                     ds.w    1                ; offset: $0 (0)
  241. format                     ds.w    1                ; offset: $2 (2)
  242. scaling                     ds        Point            ; offset: $4 (4)        ;  numer/denom scaling of priority weights <7> 
  243. spacesPerInsertion         ds.w    1                ; offset: $8 (8)        ;  # of $20 chars in justification insertion string <12> 
  244. justStringOffset         ds.w    1                ; offset: $A (10)        ;  offset to justification string 
  245. stateTable                 ds        WSIJustificationStateTable ; offset: $C (12) ;  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  246. sizeof                     EQU *                    ; size:   $14 (20)
  247.                         ENDR
  248.  
  249. ;  Line Layout's Property table version <11> 
  250.  
  251.                                                             ; v1.0 
  252. currentPropsTableVersion        EQU        $00010000
  253.  
  254.                                                             ; version is octal 0100 or hex 0x40 (#64) 
  255. kCharToGlyphCurrentVersion        EQU        $40
  256. ;  pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  257.  
  258. kScriptsDefaultJustWeight        EQU        -1
  259.  
  260. ;  feature selectors used in FindScriptRun and itl5 configuration tables <9> 
  261. ; typedef UInt16                         WSIFeatureType
  262.  
  263. ; typedef UInt16                         WSIFeatureSelector
  264.  
  265. WSIFeature                RECORD 0
  266. featureType                 ds.w    1                ; offset: $0 (0)
  267. featureSelector             ds.w    1                ; offset: $2 (2)
  268. sizeof                     EQU *                    ; size:   $4 (4)
  269.                         ENDR
  270.     ENDIF ; __WORLDSCRIPT__ 
  271.  
  272.